package com.naiterui.common.repository.config;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * <pre>
 *     多mongo配置文件
 * </pre>
 *
 * @author 王泽浩
 * @date 2018/5/23 下午5:05
 * @since 1.0.0
 */
@Component
@ConfigurationProperties(value = "naiterui")
public class MultiMongoProperties {
    private List<MongoProperties> mongo = new ArrayList<>();

    public List<MongoProperties> getMongo() {
        return this.mongo;
    }

    public void setMongo(List<MongoProperties> mongo) {
        this.mongo = mongo;
    }

    @Override
    public String toString() {
        return "MultiMongoProperties{" + "mongo=" + this.mongo + '}';
    }

    public static class MongoProperties extends org.springframework.boot.autoconfigure.mongo.MongoProperties {

        /**
         * Qualifier 绑定
         */
        private String beanName;

        public String getBeanName() {
            return this.beanName;
        }

        public void setBeanName(String beanName) {
            this.beanName = beanName;
        }

        @Override
        public String toString() {
            return "MongoProperties{" + "beanName='" + this.beanName + '\'' + '}';
        }
    }
}
